{layout name="../common/master"/}
<div id="right">
    <form action="" method="get" role="form">
        <div class="form-group">
            <label for="">发送时间：</label>
            <input name="sendStart" {if condition="isset($_GET['sendStart'])"} value="{$_GET['sendStart']}" {/if} type="text" id="" onclick="WdatePicker({startDate:'2017-11-01',alwaysUseStartDate:true})"/>
            ~
            <input name="sendEnd" {if condition="isset($_GET['sendEnd'])"} value="{$_GET['sendEnd']}" {/if} type="text" id="" onclick="WdatePicker({startDate:'2017-11-01',alwaysUseStartDate:true})"/>

            <label for="">短信内容：</label>
            <input name="sms_content" {if condition="isset($_GET['sms_content'])"} value="{$_GET['sms_content']}" {/if} type="text"/>
            <input name="uid" hidden value="{$_GET['uid']}" type="text"/>

            <button type="submit" class="btn btn-primary">查询</button>
            <a href="{:URL('home/User/userList',['sms_status'=>0])}" class="btn btn-success">返回</a>
        </div>
    </form>
    <div>
        <button id="extend" type="submit" class="btn btn-info">导出到EXCEL</button>
        <button id="checkPass" type="submit" class="btn btn-success">审核通过</button>
        <button id="checkNoPass" type="submit" class="btn btn-danger">审核不通过</button>
        <button id="nosms"  type="submit" class="btn btn-info">无短信</button>
    </div>

    <div class="panel panel-default col-lg-12">
        <div class="panel-heading">
            <h3 class="panel-title">用户短信</h3>
        </div>
        <div class="panel-body">
            <table class="table-bordered table  table-hover" style="margin-top: 20px;">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>用户ID</th>
                    <th>手机号</th>
                    <th>发送人</th>
                    <th>发送人手机号</th>
                    <th>发送时间</th>
                    <th>短信内容</th>
                    <th>类型</th>
                </tr>
                </thead>
                <tbody>
                {foreach name="data" item="vo" key="k"}
                <tr>
                    <th>{$vo['id']}</th>
                    <th>{$vo['user_id']}</th>
                    <th>{$vo['user_phone']}</th>
                    <th>{$vo['from_user_name']}</th>
                    <th>{$vo['from_phone_num']}</th>

                    <th> {:date("Y-m-d H:i:s",($vo['send_time']/1000))}</th>
                    <th>{$vo['sms_content']}</th>
                    <th>{$vo['plantform']}</th>
                </tr>
                {/foreach}
                </tbody>
            </table>
            {$page} 总数：{$totalCount}
        </div>
    </div>
    </div>
</div>
<script>
    var uid="{$_GET['uid']}";
    $("#extend").click(function () {
       var url="{:URL('home/User/usersms',$_GET)}";
        url=url+"&extend=1";
        location.href=url;
    })

    $("#checkPass").click(function () {
        var data={
            uid:uid,
            admin_sms_status:1
        }
        $.post("{:URL('home/User/updateUser')}",data,function(res){
           if(res.code == 0){
               layer.alert('success')
           }else{
               layer.alert('error')
           }
        })
    })

    $("#checkNoPass").click(function () {
        var data={
            uid:uid,
            admin_sms_status:2
        }
        $.post("{:URL('home/User/updateUser')}",data,function(res){
            if(res.code == 0){
                layer.alert('success')
            }else{
                layer.alert('error')
            }
        })
    })

    $("#nosms").click(function () {
        var data={
            uid:uid,
            admin_sms_status:3
        }
        $.post("{:URL('home/User/updateUser')}",data,function(res){
            if(res.code == 0){
                layer.alert('success')
            }else{
                layer.alert('error')
            }
        })
    })

</script>
<script type="text/javascript" src="__PUBLIC__/home/tuo/DatePicker/WdatePicker.js"></script>